﻿<%@ Page Title="" Language="C#" MasterPageFile="~/CricketAdmin.master" AutoEventWireup="true"CodeFile="TeamScore.aspx.cs"Inherits="TeamScore" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
<script language="javascript" src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        function SaveScore() {            
            
            var matchScheduleId = $('#<%=drpMatch.ClientID %>').val();
            var teamId = $('#<%=drpTeam.ClientID %>').val(); ;
            var run = $('#<%=txtRun.ClientID %>').val();
            var over = $('#<%=txtOver.ClientID %>').val();
            var wicket = $('#<%=txtWicket.ClientID %>').val(); 
            

            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                data: "{\"matchScheduleId\":\"" + matchScheduleId + "\",\"teamId\":\"" + teamId + "\",\"run\":\"" + run + "\",\"over\":\"" + over + "\",\"wicket\":\"" + wicket + "\"}",
                url: "TeamScore.aspx/SaveTeamScore",
                dataType: "json",
                success: function (data) {

                    if (data.d == 1) {
                        $('#<%=txtOver.ClientID %>').focus();
                        alert('Record Saved Sucessfully !!!')

                    }
                },
                error: function (response) {
                    alert('error')
                }
            });

        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="container-fluid">
        <h3 class="page-title">
            Add Score<small></small>
        </h3>
        <%--<ul class="breadcrumb">
            <li><i class="icon-home"></i>Entry<span class="icon-angle-right"> </span></li>
            <li>Score<span class="icon-angle-right"></span></li>
        </ul>--%>
        <div class="alert alert-danger" id="layerError" runat="server" style="display: none;">
        </div>
        <div class="alert alert-success" id="layerSuccess" runat="server" style="display: none;">
        </div>
        <div class="row-fluid">
            <div class="span12">
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            Add Score</div>
                    </div>
                    <div class="portlet-body form">
                        <div class="form-horizontal form-view">
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Select Match<span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:DropDownList ID="drpMatch" runat="server" OnSelectedIndexChanged="drpMatch_SelectedIndexChanged"
                                                AutoPostBack="true">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="rfvMatch" runat="server" ErrorMessage="Please select match"
                                                InitialValue="0" ValidationGroup="Score" CssClass="required" ControlToValidate="drpMatch"
                                                Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Select Team<span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:DropDownList ID="drpTeam" runat="server">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="rfvTeam" runat="server" ErrorMessage="Please selecct team"
                                                InitialValue="0" ValidationGroup="Score" CssClass="required" ControlToValidate="drpTeam"
                                                Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Over<span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:TextBox ID="txtOver" runat="server" CssClass="span6 m-wrap"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvOver" runat="server" ErrorMessage="Please enter over."
                                                ValidationGroup="Team" CssClass="required" ControlToValidate="txtOver" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Run<span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:TextBox ID="txtRun" runat="server" CssClass="span6 m-wrap"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvRun" runat="server" ErrorMessage="Please enter run."
                                                ValidationGroup="Team" CssClass="required" ControlToValidate="txtRun" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label">
                                            Wicket<span class="required">*</span></label>
                                        <div class="controls">
                                            <asp:TextBox ID="txtWicket" runat="server" CssClass="span6 m-wrap"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter wicket."
                                                ValidationGroup="Team" CssClass="required" ControlToValidate="txtWicket" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="form-actions">
                                <input id="btnSubmit" type="button" value="Start" class="btn red" onclick="SaveScore()" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
